--{"Event-Subclass":"sofia::unregister","Event-Name":"CUSTOM","Core-UUID":"69b8d28c-3ff9-11e9-8f2f-d91fe25a972c","FreeSWITCH-Hostname":"localhost.localdomain","FreeSWITCH-Switchname":"localhost.localdomain","FreeSWITCH-IPv4":"192.168.31.120","FreeSWITCH-IPv6":"::1","Event-Date-Local":"2019-03-07 15:35:08","Event-Date-GMT":"Thu, 07 Mar 2019 07:35:08 GMT","Event-Date-Timestamp":"1551944108881593","Event-Calling-File":"sofia_reg.c","Event-Calling-Function":"sofia_reg_handle_register_token","Event-Calling-Line-Number":"2156","Event-Sequence":"16148","profile-name":"internal","username":"1002","from-user":"1002","from-host":"192.168.31.120","contact":"\"1002\" <sip:1002@192.168.31.133:53412;rinstance=a55f8e8760624d5a>","call-id":"Yzg3NWI4Mzc4ZTNlZTBlZWI0MjE2Mzk4OGY2NGU3MTM.","rpid":"unknown","realm":"192.168.31.120","network-ip":"192.168.31.133","network-port":"53412","user-agent":"eyeBeam release 1011d stamp 40820","expires":"0"}




local username=event:getHeader("username");

if(username ==nil)then
	return "break";
end;

freeswitch.consoleLog("info",username.."注册");

local api=freeswitch.API();

local cmd="callcenter_config agent set status "..username.." 'Available'";

freeswitch.consoleLog("info","执行命令"..cmd);
--local reply=api:executeString(cmd);

--freeswitch.consoleLog("info","执行callcenter上线结果结果"..reply);

if(allagent == nil)then
	allagent={};	
end


 allagent[username]=username;

